package de.ars.client.items;

import de.ars.client.animator.AbstractSlideItemAnimator;
import de.ars.client.animator.IAnimationEventListener;
import de.ars.client.paintSystems.ClassicLayout;

public class EditItemAnimator extends AbstractSlideItemAnimator
{
	public static final float STANDARD_ANIMATION_SPEED = 5f;
    public static final float STANDARD_SCROLL_SPEED = 10.0f;
    
    public static final int POINT_EDIT_POS = 0;
    public static final int POINT_EDIT_SIZE = 1;
    public static final int POINT_EDIT_TEXT_POS = 2;
    
	private ClassicLayout layout;
	
	public EditItemAnimator(IAnimationEventListener listener) 
	{
		super(listener);
	}
	
	public void setLayout(ClassicLayout layout)
    {
        this.layout = layout;
    }
	
	public void openItem()
	{
		this.startAnimationTo(POINT_EDIT_POS, this.layout.getEditPos(), STANDARD_ANIMATION_SPEED);
		this.startAnimationTo(POINT_EDIT_TEXT_POS, this.layout.getEditTextPos(), STANDARD_ANIMATION_SPEED);
		
		listener.animationEvent(IAnimationEventListener.ANIMATION_STARTED);
	}
	
	public void closeItem()
	{
		this.startAnimationTo(POINT_EDIT_POS, this.layout.getEditClosePos(), STANDARD_ANIMATION_SPEED);
		this.startAnimationTo(POINT_EDIT_TEXT_POS, this.layout.getEditCloseTextPos(), STANDARD_ANIMATION_SPEED);
		
		listener.animationEvent(IAnimationEventListener.ANIMATION_STARTED);
	}
}